package com.tianyang.yukuaifuzs.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import cn.jpush.android.service.DaemonService;

/**
 * Description：开机自启广播
 * Created by 薛勇军 on 2020/3/9.
 */
public class BootReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction() != null) {
            switch (intent.getAction()) {
                case "com.tianyang.yukuaifu.destroy":
                case Intent.ACTION_BOOT_COMPLETED:
                    //启动极光推送的服务
                    context.startService(new Intent(context, DaemonService.class));
                    context.startService(new Intent(context, PushService.class));
                    break;
                case Intent.ACTION_USER_PRESENT:
                    //解锁时发出的intent.
                    break;
            }
        }
    }
}
